/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package co.com.smart.hawk.controller.impl;

import co.com.smart.hawk.controller.HawkArticulosCtrl;
import co.com.smart.hawk.dto.ArticulosDTO;
import co.com.smart.hawk.dto.DatosMaestrosDTO;
import co.com.smart.hawk.model.caller.ArticulosCaller;
import co.com.smart.hawk.model.caller.MaestrosCaller;
import co.com.smart.hawk.utilities.Utility.CallBackSmartHawk;
import java.util.List;
import javax.persistence.EntityManager;

/**
 *
 * @author user
 */
public class HawkArticulosCtrlImpl  implements HawkArticulosCtrl {

    private EntityManager entityManager;
    private MaestrosCaller caller;
    private ArticulosCaller callerArticulos;
    
    public HawkArticulosCtrlImpl() {
        this(null);
    }

    public HawkArticulosCtrlImpl(EntityManager entityManager) {
        this.entityManager = entityManager;
        caller = new MaestrosCaller();
        callerArticulos = new ArticulosCaller();
    }

    @Override
    public void cargarDatosMaestros(CallBackSmartHawk<List<DatosMaestrosDTO>> callBack, DatosMaestrosDTO filtro) throws Throwable {
        callBack.endProcess(caller.consultarMaestros(filtro));
    }

    @Override
    public void grabarArticulo(CallBackSmartHawk<ArticulosDTO> callBack, ArticulosDTO sendObject) throws Throwable {
        callBack.endProcess(callerArticulos.grabarArticulos(sendObject));
    }

    @Override
    public void consultarArticulos(CallBackSmartHawk<List<ArticulosDTO>> callBack) {
    }

    @Override
    public void ListarArticulos(CallBackSmartHawk<List<ArticulosDTO>> callBack, ArticulosDTO filtros) throws Throwable {
        
        callBack.endProcess(callerArticulos.ListarArticulos(filtros));
        
    }
}
